"""
数据库配置文件
"""
import urllib.parse
from pathlib import Path

# 项目根目录
BASE_DIR = Path(__file__).resolve().parent.parent

# MySQL数据库配置
MYSQL_CONFIG = {
    'host': 'qa-all-master-rds8.qa.yunlizhi.net',
    'port': 3306,
    'user': 'root',
    'password': 'allqaylzDBqa1029!@#g6',  # 请修改为实际密码
    'database': 'stock_data',
    'charset': 'utf8mb4'
}

# 对密码进行URL编码
encoded_password = urllib.parse.quote_plus(MYSQL_CONFIG['password'])

# MySQL连接字符串
SQLALCHEMY_DATABASE_URI = (
    f"mysql+pymysql://{MYSQL_CONFIG['user']}:{encoded_password}@"
    f"{MYSQL_CONFIG['host']}:{MYSQL_CONFIG['port']}/{MYSQL_CONFIG['database']}?charset={MYSQL_CONFIG['charset']}"
) 